// Fill out your copyright notice in the Description page of Project Settings.


#include "PlayerAnimInstance.h"
#include "GameFramework\PawnMovementComponent.h"
#include "PlayerCharacter.h"

void UPlayerAnimInstance::NativeInitializeAnimation() 
{
	if (!Pawn)
	{
		Pawn = TryGetPawnOwner();
	}
	Player = Cast<APlayerCharacter>(Pawn);
}

void UPlayerAnimInstance::UpdateAnimation()
{
	if (!Pawn)
	{
		Pawn = TryGetPawnOwner();
	}
	else 
	{
		FVector Speed = Pawn->GetVelocity();
		FVector LaterialSpeed = FVector(Speed.X,Speed.Y,0);
		MoveSpeed = LaterialSpeed.Size();
		IsFalling = Pawn->GetMovementComponent()->IsFalling();
	}
}